import "@/assets/scss/base.scss"
import React from 'react'
import { useSelector, useDispatch} from 'react-redux'
import {increment, decrement} from '@/store/actions/xyf/xyf-actions'

export default function Xyf() {
    const count = useSelector((state) => {
        return state.add.count
    })
    const dispatch = useDispatch()
    // const increment1 = () => {
    //     useDispatch(increment(1))
    // }
    // const decrement1 = () => {
    //     useDispatch(decrement(1))
    // }
    const increment1 = () => dispatch(increment(1))
    const decrement1 = () => dispatch(decrement(1))
    return (
        <div>
            <h1>向宇峰</h1>
            <p className="red">点击{count}次数</p>
                <div>
                    <button onClick={increment1}> + </button>
                    <button onClick={decrement1}> - </button>
                </div>
        </div>
    )
}